package models

import (
	"gin-app/app/common"
	"strconv"
)

type User struct {
	common.ID
	Name     string `json:"name" gorm:"not null;comment:用户名称"`
	Mobile   string `json:"mobile" gorm:"not null;uniqueIndex;size:50;comment:用户手机号"`
	Password string `json:"-" gorm:"not null;default:'';comment:用户密码"`
	common.Timestamps
	common.SoftDeletes
}

func NewUser(name, password, mobile string) *User {
	return &User{
		Name:     name,
		Password: password,
		Mobile:   mobile,
	}

}
func (user User) GetUid() string {
	return strconv.Itoa(int(user.ID.ID))
}
